<html>
<head>
<title>AM enfermero</title>
<script type="text/javascript" src="html\maquetacion\calendar.js"></script>
<script type="text/javascript" src="html\maquetacion\calendar-setup.js"></script>
<script type="text/javascript" src="html\maquetacion\calendar-en.js"></script>


<link href="html\maquetacion\calendar-win2k-cold-1.css" type="text/css" rel="stylesheet" />
<link href="html\maquetacion\default.css" type="text/css" rel="stylesheet" />


<script type ="text/javascript">
 i = 1;
	function cargamaterial()
	{
	var k=1;

	if (i == 11)
	{
		i = disponibles();
	}
	
	if (!repetido())
		{
			if(i<11)
			{
				
				while( document.getElementById(k).value != "")
				{
					k++;
				}
				document.getElementById(k).style.visibility = 'visible';
				document.getElementById("b"+k).style.visibility = 'visible';
				textoCbo = document.getElementById('anaest');
				document.getElementById(k).value = textoCbo.options[textoCbo.selectedIndex].text;
				i++;
			}
		}	

	}
	
	
	
	function limpiarText(nomText)
	{
			var flag = 0;
			var j=0;
			var str= nomText.substr(1,1);
			str++;
			if (document.getElementById(str).value == "" )
			{
				
				str--;
				document.getElementById(str).value = "";
				document.getElementById(str).style.visibility = 'hidden';
				document.getElementById("b"+str).style.visibility = 'hidden';
		
			}
			else
			{
			str--;
			document.getElementById(str).value = "";
			for(j=10;j>=0;j--)
			{
				if (flag == 0 )
				{	
							
					if (document.getElementById(j).value != "" )
					{
						document.getElementById(str).value = document.getElementById(j).value;
						document.getElementById(j).value = "";
						document.getElementById(j).style.visibility = 'hidden';
						document.getElementById("b"+j).style.visibility = 'hidden';
						flag = 1; 
						
					}
				}
			}
			}


	}
	function disponibles()
	{	
		var j = 1;
		while(document.getElementById(j).value != "" )
		{
			j++;
		}
		return j;
	}
	
	
	function repetido()
	{
		textoCb = document.getElementById('anaest');
		var texto1 = textoCb.options[textoCb.selectedIndex].text;
		var i=1;
	
		while(document.getElementById(i).value != '')
		{

			if ( texto1 == document.getElementById(i).value)
			{
				return 1;
			}
			i++;
		}
	
		return 0;
	}
	
</script>

</head>
<body>
<? require_once '../framework/encabezado_admin.php'; ?>

<div id = "error" <?  if(!$this->error) echo "style='visibility:hidden;'";?>>Error en ingreso de datos </div>
<div> FORMULARIO ALTA Y MODIFICACIONES DE ENFERMEROS</div><br/>

	<form method = "POST" action = "a_anaest.htm"  >
		<label> Numero de documento del paciente : </label> <input type="text" name = "nrodoc"  /> <br/>
		<tr><td>Tipo documento paciente:</td>
		<td><select name="tipdoc" />
		<OPTION VALUE="dni">DNI</OPTION><OPTION VALUE="pass">PASAPORTE</OPTION><OPTION VALUE="car">CARNET SOCIO</OPTION>
		</SELECT></td></tr>
		
		<br/>
		<tr><td>seleccione analisis o estudio para la solicitud</td>

		<td>
		<? if($this->array_registros){?>
		<select name="anaest" onChange="cargamaterial();"/>

			 <?foreach ($this->array_registros as $ind=>$mat) { ?>

			
			<OPTION VALUE="<?= $mat['id_tipo_examen'] ?>"><?= $mat['descripcion_tipo_examen'] ?></OPTION>
			
		<?	 }
		} ?>
		</SELECT>
		<? /*</td></tr>
		<td><select name="anaest" onChange="cargamaterial();"/>
		<OPTION VALUE="dni">DNI</OPTION><OPTION VALUE="pass">PASAPORTE</OPTION><OPTION VALUE="car">CARNET SOCIO</OPTION>
		</SELECT>
*/ ?>

		</br>
		</br>
		<input type="text" name = "1" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b1"onClick="limpiarText('b1');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "2" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b2"onClick="limpiarText('b2');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "3" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b3"onClick="limpiarText('b3');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "4" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b4"onClick="limpiarText('b4');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "5" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b5"onClick="limpiarText('b5');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "6" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b6"onClick="limpiarText('b6');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "7" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b7"onClick="limpiarText('b7');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "8" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b8"onClick="limpiarText('b8');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "9" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b9"onClick="limpiarText('b9');" value="limpiar" style="visibility:'hidden'"> <br/>
		<input type="text" name = "10" style="visibility:'hidden'; width:400px" readonly='readonly' /><input type="button" name ="b10"onClick="limpiarText('b10');" value="limpiar" style="visibility:'hidden'"> <br/>
		
		</br>
		<input type = "submit" value = "Guardar" />
		<input type="hidden" name ="envio" value="1" />
		<input type="hidden" name ="id_usuario_med" value="id del medico" />
		
	</form>
		

<a href = "listado_anaest.htm"><h3> Volver </h3></a>


</body>
</html>